/*           Copyright(c) 2005-2008 Dave Sexton            *
 *                   HtmlEditor Control                    *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using mshtml;

namespace DaveSexton.Controls
{
	public sealed class HtmlDataTransfer
	{
		#region Public Properties
		public string DropEffect
		{
			get
			{
				return transferData.dropEffect;
			}
			set
			{
				transferData.dropEffect = value;
			}
		}

		public string EffectAllowed
		{
			get
			{
				return transferData.effectAllowed;
			}
			set
			{
				transferData.effectAllowed = value;
			}
		}

		public object this[string format]
		{
			get
			{
				return transferData.getData(format);
			}
			set
			{
				object val = value;
				if (!transferData.setData(format, ref val))
					throw new InvalidOperationException();
			}
		}
		#endregion

		#region Private / Protected
		private readonly IHTMLDataTransfer transferData;
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="HtmlDataTransfer" /> class.
		/// </summary>
		internal HtmlDataTransfer(IHTMLDataTransfer transferData)
		{
			this.transferData = transferData;
		}
		#endregion

		#region Methods
		public bool ClearData(string format)
		{
			return transferData.clearData(format);
		}

		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate"), 
		System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", MessageId = "1#")]
		public bool SetData(string format, ref object data)
		{
			return transferData.setData(format, ref data);
		}
		#endregion
	}
}
